<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人名片模版</title>
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="../css/all.min.css">
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
            --light-color: #f8f9fa;
            --dark-color: #212529;
            --text-color: #495057;
            --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Poppins', sans-serif;
            background: #fff;
            color: var(--text-color);
            line-height: 1.6;
            min-height: 100vh;
            padding: 20px;
            overflow-x: hidden;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 25px;
        }

        h1,
        h2,
        h3,
        h4 {
            font-family: 'Playfair Display', serif;
            font-weight: 700;
            color: var(--dark-color);
        }

        h1 {
            font-size: 2rem;
            margin-bottom: 15px;
            background: linear-gradient(90deg, #2c3e50, #3498db);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .editor-panel {
            background-color: white;
            padding: 15px;
            border-radius: 10px;
            box-shadow: var(--shadow);
            transition: var(--transition);
            position: relative;
            overflow-y: auto;
        }

        .preview-panel {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
        }

        .panel-title {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .panel-title i {
            margin-right: 8px;
            color: var(--secondary-color);
            font-size: 1.2rem;
        }

        .panel-title h2 {
            font-size: 1.3rem;
        }

        .form-group {
            margin-bottom: 10px;
            position: relative;
        }

        label {
            display: block;
            margin-bottom: 3px;
            font-weight: 600;
            color: var(--dark-color);
            font-size: 0.85rem;
        }

        input,
        textarea,
        select {
            width: 100%;
            padding: 8px 10px;
            border: 1px solid #e0e0e0;
            border-radius: 5px;
            font-family: inherit;
            font-size: 14px;
            transition: var(--transition);
            background-color: var(--light-color);
        }

        input:focus,
        textarea:focus,
        select:focus {
            outline: none;
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
        }

        .input-icon {
            position: relative;
        }

        .input-icon i {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--secondary-color);
            font-size: 14px;
        }

        .input-icon input,
        .input-icon textarea {
            padding-left: 30px;
        }

        .button-group {
            display: flex;
            gap: 12px;
            margin-top: 15px;
        }

        button {
            color: white;
            border: none;
            padding: 8px 12px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: var(--transition);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 1;
        }

        button i {
            margin-right: 6px;
            font-size: 13px;
        }

        .btn-primary {
            background-color: var(--secondary-color);
        }

        .btn-primary:hover {
            background-color: #2980b9;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(41, 128, 185, 0.3);
        }

        .btn-secondary {
            background-color: #6c757d;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
            transform: translateY(-2px);
        }

        .color-options {
            display: flex;
            gap: 8px;
            margin-top: 8px;
            flex-wrap: wrap;
        }

        .color-option {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            transition: var(--transition);
            position: relative;
        }

        .color-option:hover {
            transform: scale(1.1);
        }

        .color-option.selected::after {
            content: '\f00c';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 10px;
        }

        /* 名片样式 */
        .business-card {
            width: 440px;
            height: 280px;
            background-color: white;
            border-radius: 15px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
            padding: 30px;
            position: relative;
            overflow: hidden;
            transition: var(--transition);
            border: 1px solid rgba(255, 255, 255, 0.2);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            backdrop-filter: blur(5px);
        }

        .business-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 15px;
            position: relative;
            z-index: 2;
        }

        .name {
            font-size: 26px;
            font-weight: 700;
            color: var(--primary-color);
            margin-bottom: 4px;
            line-height: 1.2;
        }

        .title {
            font-size: 20px;
            color: var(--secondary-color);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .company {
            font-size: 18px;
            font-weight: 600;
            color: var(--primary-color);
            background-color: rgba(255, 255, 255, 0.7);
            padding: 3px 8px;
            border-radius: 12px;
        }

        .card-body {
            margin-bottom: 10px;
            position: relative;
            z-index: 2;
        }

        .contact-info {
            list-style: none;
        }

        .contact-info li {
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            font-size: 14px;
        }

        .contact-info i {
            width: 18px;
            margin-right: 8px;
            color: var(--secondary-color);
            font-size: 14px;
            text-align: center;
        }

        .qrcode-container {
            position: absolute;
            bottom: 20px;
            right: 20px;
            width: 100px;
            height: 100px;
            border-radius: 5px;
            overflow: hidden;
            border: 3px solid white;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
            background-color: #f1f1f1;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
        }

        .qrcode-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .qrcode-placeholder {
            color: #ccc;
            font-size: 32px;
        }

        .qrcode-upload {
            display: none;
        }

        .qrcode-label {
            position: absolute;
            bottom: 0;
            right: 0;
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            width: 100%;
            text-align: center;
            padding: 3px;
            font-size: 10px;
            cursor: pointer;
            opacity: 0;
            transition: var(--transition);
        }

        .qrcode-container:hover .qrcode-label {
            opacity: 1;
        }

        .decoration {
            position: absolute;
            z-index: 1;
            opacity: 0.7;
        }

        .decoration-1 {
            top: -40px;
            right: -40px;
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
            filter: blur(8px);
        }

        .decoration-2 {
            bottom: -60px;
            left: -60px;
            width: 160px;
            height: 160px;
            border-radius: 50%;
            background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
            filter: blur(12px);
        }

        /* 主题样式 */
        .theme-classic {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
        }

        .theme-modern {
            --primary-color: #34495e;
            --secondary-color: #1abc9c;
            --accent-color: #f39c12;
        }

        .theme-elegant {
            --primary-color: #6c5ce7;
            --secondary-color: #a29bfe;
            --accent-color: #fd79a8;
        }

        .theme-minimal {
            --primary-color: #2d3436;
            --secondary-color: #636e72;
            --accent-color: #dfe6e9;
        }

        .theme-premium {
            --primary-color: #2c3e50;
            --secondary-color: #e74c3c;
            --accent-color: #3498db;
        }

        .theme-nature {
            --primary-color: #2c3e50;
            --secondary-color: #27ae60;
            --accent-color: #f39c12;
        }

        .theme-royal {
            --primary-color: #3a0ca3;
            --secondary-color: #7209b7;
            --accent-color: #f72585;
        }

        .theme-ocean {
            --primary-color: #023e8a;
            --secondary-color: #0096c7;
            --accent-color: #48cae4;
        }

        .theme-earth {
            --primary-color: #6b4226;
            --secondary-color: #d4a59a;
            --accent-color: #a68a64;
        }

        .theme-sunset {
            --primary-color: #ff5400;
            --secondary-color: #ff6d00;
            --accent-color: #ff9e00;
        }

        /* 新增中间渐变横线样式 */
        .business-card::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 10%;
            right: 10%;
            height: 1px;
            background: linear-gradient(to right, transparent, var(--secondary-color), transparent);
            z-index: 2;
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .container {
                grid-template-columns: 1fr;
                height: auto;
            }

            .business-card {
                width: 100%;
                max-width: 550px;
                margin: 20px auto;
            }
        }

        @media (max-width: 576px) {
            .editor-panel {
                padding: 15px;
            }

            h1 {
                font-size: 1.6rem;
            }

            .business-card {
                height: auto;
                padding: 20px;
            }

            .button-group {
                flex-direction: column;
            }

            .qrcode-container {
                width: 80px;
                height: 80px;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="editor-panel">
            <div class="panel-title">
                <i class="fas fa-user-edit"></i>
                <h2>个人信息</h2>
            </div>

            <div class="form-group">
                <label for="fullName">全名</label>
                <div class="input-icon">
                    <i class="fas fa-signature"></i>
                    <input type="text" id="fullName" placeholder="例如: 张三">
                </div>
            </div>

            <div class="form-group">
                <label for="jobTitle">职位</label>
                <div class="input-icon">
                    <i class="fas fa-briefcase"></i>
                    <input type="text" id="jobTitle" placeholder="例如: 技术总监">
                </div>
            </div>

            <div class="form-group">
                <label for="company">公司/组织</label>
                <div class="input-icon">
                    <i class="fas fa-building"></i>
                    <input type="text" id="company" placeholder="例如: 北京XX科技有限公司">
                </div>
            </div>

            <div class="panel-title" style="margin-top: 20px;">
                <i class="fas fa-address-card"></i>
                <h2>联系信息</h2>
            </div>

            <div class="form-group">
                <label for="phone">电话</label>
                <div class="input-icon">
                    <i class="fas fa-phone"></i>
                    <input type="tel" id="phone" placeholder="例如: 138-1234-5678">
                </div>
            </div>

            <div class="form-group">
                <label for="email">电子邮箱</label>
                <div class="input-icon">
                    <i class="fas fa-envelope"></i>
                    <input type="email" id="email" placeholder="例如: yourname@example.com">
                </div>
            </div>

            <div class="form-group">
                <label for="address">地址</label>
                <div class="input-icon">
                    <i class="fas fa-map-marker-alt"></i>
                    <textarea id="address" rows="2" placeholder="例如: 北京市海淀区中关村大街1号"></textarea>
                </div>
            </div>

            <div class="panel-title" style="margin-top: 20px;">
                <i class="fas fa-palette"></i>
                <h2>主题配色</h2>
            </div>

            <div class="form-group">
                <div class="color-options">
                    <div class="color-option selected" style="background-color: #2c3e50;" data-theme="theme-classic"
                        title="经典蓝"></div>
                    <div class="color-option" style="background-color: #34495e;" data-theme="theme-modern"
                        title="现代绿"></div>
                    <div class="color-option" style="background-color: #6c5ce7;" data-theme="theme-elegant"
                        title="优雅紫"></div>
                    <div class="color-option" style="background-color: #2d3436;" data-theme="theme-minimal"
                        title="极简黑"></div>
                    <div class="color-option" style="background-color: #e74c3c;" data-theme="theme-premium"
                        title="高级红"></div>
                    <div class="color-option" style="background-color: #27ae60;" data-theme="theme-nature"
                        title="自然绿"></div>
                    <div class="color-option" style="background-color: #3a0ca3;" data-theme="theme-royal"
                        title="皇家紫"></div>
                    <div class="color-option" style="background-color: #023e8a;" data-theme="theme-ocean"
                        title="海洋蓝"></div>
                    <div class="color-option" style="background-color: #6b4226;" data-theme="theme-earth"
                        title="大地棕"></div>
                    <div class="color-option" style="background-color: #ff5400;" data-theme="theme-sunset"
                        title="日落橙"></div>
                </div>
            </div>

            <div class="button-group">
                <button id="updateCard" class="btn-primary">
                    <i class="fas fa-sync-alt"></i> 更新名片
                </button>
                <button id="resetCard" class="btn-secondary">
                    <i class="fas fa-times"></i> 取消
                </button>
            </div>
        </div>

        <div class="preview-panel">
            <div class="business-card theme-classic" id="businessCard">
                <div class="decoration decoration-1"></div>
                <div class="decoration decoration-2"></div>

                <div class="card-header">
                    <div>
                        <h3 class="name" id="cardName">张三</h3>
                        <p class="title" id="cardTitle">技术总监</p>
                    </div>
                    <div class="company" id="cardCompany">北京XX科技有限公司</div>
                </div>

                <div class="card-body">
                    <ul class="contact-info">
                        <li><i class="fas fa-phone"></i> <span id="cardPhone">138-1234-5678</span></li>
                        <li><i class="fas fa-envelope"></i> <span id="cardEmail">yourname@example.com</span></li>
                        <li><i class="fas fa-map-marker-alt"></i> <span id="cardAddress">北京市海淀区中关村大街1号</span></li>
                    </ul>
                </div>

                <div class="qrcode-container" id="qrcodeContainer">
                    <div class="qrcode-placeholder">
                        <i class="fas fa-qrcode"></i>
                    </div>
                    <input type="file" id="qrcodeUpload" class="qrcode-upload" accept="image/*">
                    <label for="qrcodeUpload" class="qrcode-label">选择</label>
                </div>
            </div>
        </div>

    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            // 获取所有DOM元素
            const fullNameInput = document.getElementById('fullName');
            const jobTitleInput = document.getElementById('jobTitle');
            const companyInput = document.getElementById('company');
            const phoneInput = document.getElementById('phone');
            const emailInput = document.getElementById('email');
            const addressInput = document.getElementById('address');

            const cardName = document.getElementById('cardName');
            const cardTitle = document.getElementById('cardTitle');
            const cardCompany = document.getElementById('cardCompany');
            const cardPhone = document.getElementById('cardPhone');
            const cardEmail = document.getElementById('cardEmail');
            const cardAddress = document.getElementById('cardAddress');

            const updateBtn = document.getElementById('updateCard');
            const resetBtn = document.getElementById('resetCard');
            const businessCard = document.getElementById('businessCard');
            const colorOptions = document.querySelectorAll('.color-option');
            const qrcodeContainer = document.getElementById('qrcodeContainer');
            const qrcodeUpload = document.getElementById('qrcodeUpload');
            const qrcodePlaceholder = document.querySelector('.qrcode-placeholder');

            // 更新名片函数
            function updateCard() {
                // 更新内容
                cardName.textContent = fullNameInput.value || '张三';
                cardTitle.textContent = jobTitleInput.value || '技术总监';
                cardCompany.textContent = companyInput.value || '北京XX科技有限公司';
                cardPhone.textContent = phoneInput.value || '138-1234-5678';
                cardEmail.textContent = emailInput.value || 'yourname@example.com';
                cardAddress.textContent = addressInput.value || '北京市海淀区中关村大街1号';
            }

            // 重置表单函数
            function resetForm() {
                fullNameInput.value = '';
                jobTitleInput.value = '';
                companyInput.value = '';
                phoneInput.value = '';
                emailInput.value = '';
                addressInput.value = '';

                // 重置主题为默认
                colorOptions.forEach(opt => opt.classList.remove('selected'));
                document.querySelector('.color-option[data-theme="theme-classic"]').classList.add('selected');
                businessCard.className = 'business-card theme-classic';

                // 重置二维码
                qrcodePlaceholder.style.display = 'flex';
                const img = qrcodeContainer.querySelector('img');
                if (img) {
                    qrcodeContainer.removeChild(img);
                }

                // 更新名片显示
                updateCard();
            }

            // 主题切换
            colorOptions.forEach(option => {
                option.addEventListener('click', function () {
                    colorOptions.forEach(opt => opt.classList.remove('selected'));
                    this.classList.add('selected');

                    const theme = this.getAttribute('data-theme');
                    businessCard.className = 'business-card ' + theme;
                });
            });

            // 二维码选择
            qrcodeUpload.addEventListener('change', function (e) {
                const file = e.target.files[0];
                if (file) {
                    const reader = new FileReader();
                    reader.onload = function (event) {
                        qrcodePlaceholder.style.display = 'none';
                        let img = qrcodeContainer.querySelector('img');
                        if (!img) {
                            img = document.createElement('img');
                            qrcodeContainer.appendChild(img);
                        }
                        img.src = event.target.result;
                    }
                    reader.readAsDataURL(file);
                }
            });

            // 更新按钮事件
            updateBtn.addEventListener('click', function () {
                updateCard();
            });

            // 重置按钮事件
            resetBtn.addEventListener('click', function () {
                resetForm();
            });

            // 初始化名片
            updateCard();
        });
    </script>
</body>

</html>
    